<{include file="Common/head"}>
<{include file="Common/menu"}>

<link href="_index_/yy/index.css" rel="stylesheet">
<link href="_index_/yy/laydate.css" rel="stylesheet">
<script src="_index_/yy/laydate.js"></script>
<script type="text/javascript" src="_index_/laydate/laydate.js"></script>
<style type="text/css">

    .submit,.reset{    cursor: pointer;}
	#test-limit3{  width: 40%;  height: 30px;  padding: 2px 5px;  font-size: 18px;  color: #555;  }
    #test-limit2{    height: 30px;  padding: 2px 5px;  font-size: 18px;  color: #555;  }
    .appointment .physician input{width:15px;height:15px;}
    .appointment .position input{width:15px;height:15px;}
    .colorred{color:red;}
    .phone,.yaoyue{height:40px;}
    .test-5::-webkit-scrollbar {/*滚动条整体样式*/
        width: 10px;     /*高宽分别对应横竖滚动条的尺寸*/
        height: 1px;
    }
    .test-5::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
        border-radius: 10px;
        -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
        background: #ddd;
    }
    .test-5::-webkit-scrollbar-track {/*滚动条里面轨道*/
        -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
        border-radius: 10px;
        background: #fff;
    }
    .time_hour,.time_min{border: solid 1px #eee;}
    .Hui-article-box{ top:15px!important;}
</style>

<section class="Hui-article-box test-5" >
    <form class="appointment">
        <ul>


            <li>
                <h2>顾客姓名：</h2>
                <input type="text" autocomplete="off" name="name" class="layui-input name"  placeholder="顾客姓名">
            </li>



			<li><input class="btn btn-success radius submit" type="button" value="添加"></li>
        </ul>
    </form>

</section>
<script type="text/javascript">
$(function(){
	//限定可选时间
    /*
    laydate.render({
        elem: '#test-limit3'
        ,type: 'time'
        ,min: '09:00:00'
        ,max: '19:00:00'
        ,btns: ['clear', 'confirm']
    });
     */
    $(".reset").click(function() {
        $(".appointment")[0].reset();
        $(".reback").click();
    });

    $(".submit").on("click",function(){

        //治疗项目
        obj = document.getElementsByName("position");
        check_val = [];
        for(k in obj){
            if(obj[k].checked)
                check_val.push(obj[k].value);
        }
        //医生
        obj = document.getElementsByName("doctor");
        doctor_val = [];
        for(k in obj){
            if(obj[k].checked)
                doctor_val.push(obj[k].value);
        }

        //设备zhiliaoshi
        obj = document.getElementsByName("device");
        device_val = [];
        for(k in obj){
            if(obj[k].checked)
                device_val.push(obj[k].value);
        }

        //美容师
        obj = document.getElementsByName("meirongshi");
        meirongshi_val = [];
        for(k in obj){
            if(obj[k].checked)
                meirongshi_val.push(obj[k].value);
        }

        //护士
        obj = document.getElementsByName("hushi");
        hushi_val = [];
        for(k in obj){
            if(obj[k].checked)
                hushi_val.push(obj[k].value);
        }


        if(check_val.length==0){
            alert("治疗项目必选");
            return false;
        }

        if(doctor_val.length==0&&meirongshi_val.length==0&&hushi_val.length==0){
            alert("治疗人员选项必选");
            return false;
        }
        if(device_val.length==0){
            alert("仪器必选");
            return false;
        }

        date        = $("#laydateInput").val(); //预约日期
        zhiliaoshi_val= $(".zhiliaoshi").val();
        hongmai     = $(".hongmai").val();        //会员卡号
        //time        = $(".time").val();        //治疗时间 几点钟
        time        = ($(".time_hour").val())+":"+($(".time_min").val());        //治疗时间 几点钟
        name        = $(".name").val();        //顾客姓名
        yaoyue        = $(".yaoyue").val();        //邀约
        channel     = $(".channel").val();        //渠道
        position    = check_val;        //治疗项目
        phone       = $(".phone").val();
        lengthtime  = $(".lengthtime").val();        //预计时长
        doctor      = doctor_val;         //医生
        meirongshi  = meirongshi_val;        //美容师
        device      = device_val;        //设备
        message     = $(".message").val();        //留言
        hushi       = hushi_val;//护士

        if(hongmai.length==0&&phone.length==0){
            alert("会员卡号与电话必填其一");
            return false;
        }


        var postdata = {
            "date":date,
            "hongmai":hongmai,
            "time":time,
            "name":name,
            "yaoyue":yaoyue,
            "phone":phone,
            "channel":channel,
            "position":position,
            "lengthtime":lengthtime,
            "doctor":doctor,
            "meirongshi":meirongshi,
            "device":device,
            "zhiliaoshi":zhiliaoshi_val,
            "message":message,
            "hushi":hushi
        };

        //console.log(postdata);


        $.post("/index/Index/adddata",postdata,function(e){
            if(e==1){
                $.Huimodalalert('提交成功',2000);
                window.close();
            }else{

            }
        });


    });



    //弹出式添加页面，隐藏左边菜单栏
    if(document.body.clientWidth>760){
        $(".navbar-wrapper").css("display","none");
        $("body").addClass("big-page");
        $(".dislpayArrow").css("display","none");
    }

});



</script>
<{include file="Common/footer"}>